﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Skugo.Shared
{
    public delegate void MessageFn(String message);

    public partial class CrashDialog : Form
    {
        public event MessageFn OnUserMessage;

        private const String InitialText = "We just crashed (totally our fault).\r\nTell us how it happened :D";

        public CrashDialog()
        {
            Application.EnableVisualStyles();
            InitializeComponent();
        }

        private void CrashDialog_Load(object sender, EventArgs e)
        {
            this.UserMessage.Text = InitialText;
        }

        private void UserMessage_TextChanged(object sender, EventArgs e)
        {
            this.UserMessage.ForeColor = SystemColors.WindowText;
        }

        private void SendMessage_Click(object sender, EventArgs e)
        {
            if (this.OnUserMessage != null && this.UserMessage.Text != InitialText)
            {
                this.OnUserMessage(this.UserMessage.Text);
            }

            this.Visible = false;
            this.Close();
        }
    }
}
